package com.lattice.controller;

import com.lattice.entity.dto.LatticeNoteUploadFileDTO;
import com.lattice.entity.po.LatticeResultPO;
import com.lattice.entity.vo.LatticeResultVO;
import com.lattice.entity.dto.LatticeQueryDTO;
import com.lattice.result.ResponseResult;
import com.lattice.service.LatticeNoteManagerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description: TODO
 * @Author: mis_wu
 * @Date: 2022/11/18
 **/
@RestController
@RequestMapping("/latticeNoteOperator")
@Api(tags = "网格笔记操作控制器类",value = "对标签增删改查")
public class LatticeNoteManagerController {

    @Resource
    private LatticeNoteManagerService latticeNoteManagerService;

    @PostMapping("/latticeLike/getAllLatticeNoteByPage")
    @ApiOperation(value = "分页获取所有网格信息")
    ResponseResult<LatticeResultVO> getAllLatticeNoteByPage(@RequestBody LatticeQueryDTO latticeQueryDTO){
        return ResponseResult.isSuccess(latticeNoteManagerService.getAllLatticeNoteByPage(latticeQueryDTO));
    }

    @PostMapping("/latticeLike/addLatticeNoteInfo")
    @ApiOperation(value = "添加网格信息-文件上传")
    ResponseResult<Boolean> addLatticeNoteInfo(@RequestBody LatticeNoteUploadFileDTO latticeNoteUploadFileDTO){
        return ResponseResult.isSuccess(latticeNoteManagerService.addLatticeNoteInfo(latticeNoteUploadFileDTO));
    }

    @GetMapping("/latticeLike/deleteLatticeNoteInfo/{latticeId}")
    @ApiOperation(value = "删除网格信息")
    ResponseResult<Boolean> deleteLatticeNoteInfo(@PathVariable("latticeId") Long latticeId){
        return ResponseResult.isSuccess(latticeNoteManagerService.deleteLatticeNoteInfo(latticeId));
    }

    @PostMapping("/latticeLike/updateLatticeNoteInfo")
    @ApiOperation(value = "修改网格信息")
    ResponseResult<Boolean> updateLatticeNoteInfo(@RequestBody LatticeResultPO latticeResultPO){
        return ResponseResult.isSuccess(latticeNoteManagerService.updateLatticeNoteInfo(latticeResultPO));
    }

}
